package com.swind.fast.modules.app.railway.project.constant;

import com.swind.fast.common.util.oConvertUtils;

/**
 * Query 规则 常量
 */
public enum ProjectStatusEnum {

    ONGOING(1,"ongoing","在建"),
    CHECKING(2,"checking","待审核"),
    CHECKED(3,"checked","审核完成"),
    APPROVING(4,"approving","待审批"),
    FINISHED(5,"finished","完成");

    private Integer value;
    private String name;
    private String msg;

    ProjectStatusEnum(Integer value, String name, String msg){
        this.value = value;
        this.name = name;
        this.msg = msg;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static ProjectStatusEnum getByValue(String value){
        Integer ivalue = oConvertUtils.getInt(value);
        if (ivalue == 0) {
            return null;
        }
        for (ProjectStatusEnum val :values()){
            if (val.getValue().equals(ivalue) || val.getName().equals(value)){
                return val;
            }
        }
        return null;
    }

    public static ProjectStatusEnum getByName(String name){
        if (oConvertUtils.isEmpty(name)) {
            return null;
        }
        for (ProjectStatusEnum val :values()) {
            if (val.getName().equals(name)) {
                return val;
            }
        }
        return null;
    }
}
